<?php
 class Qlhelper{
     function selectidloatin($id = false){
        $data = Yii::app()->db->createCommand('select * from loaitin')->queryAll();
         $html ='<select name="Baiviet[IDloaitin]">';
            foreach($data as $val){
                if($val['IDloaitin'] == $id)    
                    $html .="<option selected value='".$val['IDloaitin']."'>".$val['tenloaitin']."</option>";
                else
                    $html .="<option value='".$val['IDloaitin']."'>".$val['tenloaitin']."</option>";
            }
         $html .="</select>";
         return $html;
     }
 }